<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!doctype html>
<html>
<head>
<title>兑换记录 -- </title>
<base href="<%=basePath%>" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/png" href="i/buyu.ico">
<link rel="apple-touch-icon-precomposed" href="i/app-icon72x72@2x.png">
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
<link rel="stylesheet" href="css/amazeui.min.css" />
<link rel="stylesheet" href="css/admin.css">
<link rel="stylesheet" href="css/app.css">
<link rel="stylesheet" href="layui/css/layui.css" media="all" />
<style type="text/css">
.waterTable tr td {
	background: #f3f4f6;
}

.water-field {
	font-size: 16px;
	font-weight: bold;
}

.info-field {
	border-bottom: 0;
}

.edit-field {
	display: none;
}

.tpl-block {
	font-size: 14px;
}

.layui-form-label {
	width: 120px;
}

.layui-input-block {
	margin-left: 130px;
	min-height: 36px
}
</style>
</head>
<body data-type="generalComponents">

	
			<jsp:include
		page="../header.jsp">
		<jsp:param value="5" name="a" />
		<jsp:param value="1" name="b" />
	</jsp:include>

	<div class="tpl-page-container tpl-page-header-fixed">
		<div class="tpl-portlet-components  am-center">
			<form class="layui-form" action="">
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label"
							style="font-size: 17px; margin-left: -10px;"><b>订单号查询</b></label>
						<div class="layui-input-inline">
							<input type="text" name="text" required lay-verify="required" id="text"
								placeholder="请输入订单号" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<div class="layui-input-inline">
							<button type="button" class="layui-btn" lay-submit="" lay-filter="save">立即提交</button><!-- lay-filter类似于选择器(事件过滤器) -->
							<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						</div>
					</div>
				</div>
			</form>
			<hr>
			<table class="layui-hide" id="test"></table>

		</div>
	</div>

	<script src="js/jquery.min.js"></script>
	<script src="layui/layui.js" charset="utf-8"></script>

	<script>
		layui.use([ 'table', 'form', 'layer', 'jquery'], function() {
			var $ = layui.jquery;
			var form = layui.form;
			var layer = layui.layer;
			var table = layui.table;

			table.render({
				elem : '#test',
				url : 'exchange/list',
				method : 'post',
				title : '兑换记录表',
				totalRow : true,
				cellMinWidth : 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
				,
				cols : [ [ {
					field : 'Order',
					width : 80,
					title : '订单号'
				}, {
					field : 'Username',
					width : 120,
					title : '玩家昵称名'
				}, {
					field : 'ID',
					width : 80,
					title : 'ID'
				}, {
					field : 'VIP',
					width : 80,
					title : 'VIP',
					sort : true
				}, {
					field : 'Rechargequota',
					width : 100,
					title : '充值额度'
				}, {
					field : 'Exchangeitems',
					title : '兑换物品',
					width : '30%',
					minWidth : 100,
					sort : true
				} //minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
				, {
					field : 'Exchangetime',
					width : 137,
					title : '兑换时间',
					sort : true
				}, {
					field : 'Deliverytime',
					width : 137,
					title : '发货时间',
					sort : true
				}, {
					field : 'Realname',
					title : '真实姓名'
				}, {
					field : 'Iphone',
					width : 137,
					title : '电话'
				}, {
					field : 'Address',
					width : 137,
					title : '地址'
				}, {
					field : 'State',
					width : 137,
					title : '状态',
					sort : true
				} ] ],
				page : true,
				response : {
					statusCode : 200
				//重新规定成功的状态码为 200，table 组件默认为 0
				},
				parseData : function(res) { //将原始数据解析成 table 组件所规定的数据
					return {
						"code" : res.status, //解析接口状态
						"msg" : res.message, //解析提示文本
						"count" : res.total, //解析数据长度
						"data" : res.rows.item
					//解析数据列表
					};
				}
			});
			
			//监听事件
			form.on('submit(save)',function(data){
				//console.log(JSON.stringify(data.field));
				//ajax提交
				$.ajax({
					type:"post",
					url:'exchange/list',
					async: true,
					data:{
						formdata:JSON.stringify(data.field)
						},
					success:function(data){
							var findID = $('#text');
							var index = layer.msg('查询中,请稍后...',{icon:16,time:false,shade:0});
							setTimeout(function(){
								table.reload('save',{
									page:{
										cuur:1
									}
								,where:{
									name:findID.val();
								}
								});
								layer.close(index);'
							});
					},
					error:function(data){
						layer.msg("查询失败",{icon:2});
					}
				});
				return false;  //防止不执行回调方法
			});
		});
	</script>

	<jsp:include page="../footer.jsp"></jsp:include>
</body>

</html>